/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.its.dd2.Dao;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import mx.its.dds2.modelo.Profile;
import mx.its.dds2.modelo.User;

/**
 *
 * @author Piter
 */
@Stateless
public class ProfileDao extends AbstractDao<Profile> implements ProfileDaoLocal {
    @PersistenceContext(unitName = "Farmacia-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ProfileDao() {
        super(Profile.class);
    }
    public boolean findDuplicity(Profile profile){
     Query q = em.createNamedQuery("Profile.findByDuplicity");
     q.setParameter("nombre", profile.getName());
     //q.setParameter("apellidoMaterno", user.());
     //q.setParameter("apellidoPaterno", user.getApellidoPaterno());
     return !q.getResultList().isEmpty();
 } 
    
    
}
